home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: April 29, 1997
- // Author: ramesh
- //
- // Description:
- // This script is defines the option box to stitchSurface points
- // together.
- //
-
-
- //
- // Procedure Name:
- // setOptionVars
- //
- // Description:
- // Initialize the option values.
- //
- // Input Arguments:
- // Whether to set the options to default values.
- //
- // Return Value:
- // None.
- //
- proc setOptionVars(int $forceFactorySettings)
- {
- stitchSurfacePointsSetOptionVars( $forceFactorySettings );
- }
-
- //
- // Procedure Name:
- // stitchSurfacePointsSetup
- //
- // Description:
- // Update the state of the option box UI to reflect the option values.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI.
- // Required so that UI object names can be
- // successfully resolved.
- //
- // forceFactorySettings - Whether the option values should be set to
- // default values.
- //
- // Return Value:
- // None.
- //
-
- global proc stitchSurfacePointsSetup(string $parent, int $forceFactorySettings)
- {
- // Retrieve the option settings
- //
- setOptionVars($forceFactorySettings);
-
- setParent $parent;
-
- // Query the optionVar's and set the values into the controls.
-
- // Query the optionVar's and set the values into the controls
- //
- int $keepOriginal = `optionVar -query stitchSurfacePointsKeepOriginal`;
- int $ewt = `optionVar -query stitchSurfacePointsEqualWts`;
- int $cascade = `optionVar -query stitchSurfacePointsCascade`;
-
- checkBoxGrp -edit -value1 $keepOriginal keepOriginalCheckBox;
- checkBoxGrp -edit -value1 $ewt stitchSrfPtsEqualWtsCheckBox;
- checkBoxGrp -edit -value1 $cascade stitchSrfPtsCascadeCheckBox;
- }
-
- //
- // Procedure Name:
- // stitchSurfacePointsCallback
- //
- // Description:
- // Update the option values with the current state of the option box UI.
- //
- // Input Arguments:
- // parent - Top level parent layout of the option box UI. Required so
- // that UI object names can be successfully resolved.
- //
- // doIt - Whether the command should execute.
- //
- // Return Value:
- // None.
- //
-
- global proc stitchSurfacePointsCallback(string $parent, int $doIt)
- {
- setParent $parent;
-
- // Set the optionVar's from the current control values, and then perform
- // the command
- //
- int $keepOrig = `checkBoxGrp -query -v1 keepOriginalCheckBox`;
- optionVar -intValue stitchSurfacePointsKeepOriginal $keepOrig;
-
- int $equalWts = `checkBoxGrp -q -value1 stitchSrfPtsEqualWtsCheckBox`;
- optionVar -intValue stitchSurfacePointsEqualWts $equalWts;
-
- int $cascade = `checkBoxGrp -q -value1 stitchSrfPtsCascadeCheckBox`;
- optionVar -intValue stitchSurfacePointsCascade $cascade;
-
- if( $doIt ) {
- performStitchSurfacePoints(0);
- addToRecentCommandQueue "performStitchSurfacePoints(0)" "Stitch Surface Points";
- }
- }
-
- //
- // Procedure Name:
- // stitchSurfacePointsOptions
- //
- // Description:
- // Construct the option box UI. Involves accessing the standard option
- // box and customizing the UI accordingly.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
-
- proc stitchSurfacePointsOptions()
- {
- // Name of the command for this option box.
- //
- string $commandName = "stitchSurfacePoints";
-
- // Build the option box actions.
- //
- string $callback = ($commandName + "Callback");
- string $setup = ($commandName + "Setup");
-
- // Step 1: Get the option box.
- // ============================
- string $layout = getOptionBox();
- setParent $layout;
-
- // Step 2: Pass the command name to the option box.
- // =================================================
- setOptionBoxCommandName($commandName);
-
- // Step 3: Activate the default UI template.
- // ==========================================
- setUITemplate -pushTemplate DefaultTemplate;
-
- // Step 4: Create option box contents.
- // ===================================
-
- // Turn on the wait cursor.
- //
- waitCursor -state 1;
-
- tabLayout -scr true -tv false;
-
- string $parent = `columnLayout -adjustableColumn 1`;
-
- setParent $parent ;
- checkBoxGrp -ncb 1 -l1 "Keep Original" keepOriginalCheckBox;
- checkBoxGrp -ncb 1 -l1 "Assign Equal Weights" stitchSrfPtsEqualWtsCheckBox ;
- checkBoxGrp -ncb 1 -l1 "Cascade Stitch Node " stitchSrfPtsCascadeCheckBox ;
-
- // Turn off the wait cursor.
- //
- waitCursor -state 0;
-
- // Step 5: Deactivate the default UI template.
- // ===========================================
- //
- setUITemplate -popTemplate;
-
- // Step 6: Customize the buttons.
- // ==============================
-
- // 'Apply' button.
- //
- string $applyBtn = getOptionBoxApplyBtn();
- button -edit -l "Stitch"
- -command ($callback + " " + $parent + " " + 1)
- $applyBtn;
-
- // 'Save' button.
- //
- string $saveBtn = getOptionBoxSaveBtn();
- button -edit
- -command ($callback + " " + $parent + " " + 0 + "; hideOptionBox")
- $saveBtn;
-
- // 'Reset' button.
- //
- string $resetBtn = getOptionBoxResetBtn();
- button -edit
- -command ($setup + " " + $parent + " " + 1)
- $resetBtn;
-
- // Step 7: Set the option box title.
- // =================================
- //
- setOptionBoxTitle("Stitch Surface Points Options");
-
- // Step 8: Customize the 'Help' menu item text.
- // ============================================
- //
- setOptionBoxHelpTag( "StitchSurfacePoints" );
-
- // Step 9: Set the current values of the option box.
- // =================================================
- //
- eval (($setup + " " + $parent + " " + 0));
-
- // Step 10: Show the option box.
- // =============================
- //
- showOptionBox();
- }
-
- //
- // Procedure Name:
- // stitchSurfacePointsHelp
- //
- // Description:
- // Return a short description about this command.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // string.
- //
-
- proc string stitchSurfacePointsHelp()
- {
- return
- " Command: stitchSurfacePoints - stitch surface points together\n" +
- "Selection: surface edit points, parameter space points";
- }
-
- //
- // Procedure Name:
- // assembleCmd
- //
- // Description:
- // Construct the command that will apply the option box values.
- //
- // Input Arguments:
- // None.
- //
- // Return Value:
- // None.
- //
- proc string assembleCmd()
- {
- setOptionVars(false);
-
- string $cmd = "stitchSurfacePointsPreset";
- $cmd = $cmd + "( " ;
-
- int $doHistory = `constructionHistory -q -tgl`;
- $cmd = $cmd + $doHistory ;
- $cmd = $cmd + ", " ;
-
- int $replaceOriginal = ! `optionVar -q stitchSurfacePointsKeepOriginal`;
- $cmd = $cmd + $replaceOriginal ;
- $cmd = $cmd + ", " ;
-
- int $wt = `optionVar -q stitchSurfacePointsEqualWts`;
- $cmd = $cmd + $wt ;
- $cmd = $cmd + ", " ;
-
- int $cas = `optionVar -q stitchSurfacePointsCascade`;
- $cmd = $cmd + $cas ;
-
- $cmd = $cmd + " )" ;
-
- return $cmd;
- }
-
- //
- // Procedure Name:
- // performStitchSurfacePoints
- //
- // Description:
- // Perform the stitchSurfacePoints command using the corresponding
- // option values. This procedure will also show the option box
- // window if necessary as well as construct the command string
- // that will invoke the stitchSurfacePoints command with the current
- // option box values.
- //
- // Input Arguments:
- // 0 - Execute the command.
- // 1 - Show the option box dialog.
- // 2 - Return the command.
- //
- // Return Value:
- // None.
- //
-
- global proc string performStitchSurfacePoints(int $action)
- {
- string $cmd = "";
-
- switch ($action) {
-
- // Execute the command.
- //
- case 0:
- // Get the command.
- //
- $cmd = `assembleCmd`;
-
- // Execute the command with the option settings.
- //
- // NOTE: This following evaluation will fail because
- // this entire file exists only to serve as an example
- // for using option boxes. There is no command called
- // 'stitchSurfacePoints'.
- //
- eval($cmd);
-
- break;
-
- // Show the option box.
- //
- case 1:
- stitchSurfacePointsOptions();
- break;
-
- // Return the command string.
- //
- case 2:
- // Retrieve the option settings.
- //
- setOptionVars (false);
-
- // Get the command.
- //
- $cmd = `assembleCmd`;
- break;
-
- default :
- break ;
- }
- return $cmd;
- }
-
-